///////////////////////////////////////////////////////////////////////
// File:        OcrSink.h
// Description: 
// Author:      Philip Kommnick
// Created:     Sun September 13 13:41:56 CEST 2009
//
// This program is open source. For license terms, see the LICENSE file.
//
///////////////////////////////////////////////////////////////////////

#pragma once
#include "Sink.h"

const unsigned int itemsPerPage = 5;

class OcrSink :
	public Sink
{
public:
	OcrSink(void);
	virtual ~OcrSink(void);
	virtual void Output(Gdiplus::Bitmap &bmp);
private:
	static HRESULT CALLBACK ProgressCallback(HWND hwnd, UINT uNotification, WPARAM wParam, LPARAM lParam, LONG_PTR dwRefData);
	static HRESULT CALLBACK LanguageCallback(HWND hwnd, UINT uNotification, WPARAM wParam, LPARAM lParam, LONG_PTR dwRefData);
	static DWORD WINAPI OcrFunc(LPVOID lpParameter);
	void LangNextPage(void);
	//bool EnumLanguages(void);
	Gdiplus::BitmapData bitmapData;
	HANDLE ocrThread;
	char lang[4];
	bool rememberLang;
	TASKDIALOGCONFIG tdcProgress;
	TASKDIALOGCONFIG tdcLanguage;
	TASKDIALOG_BUTTON hideButton;
	TASKDIALOG_BUTTON langButtons[itemsPerPage];
	static std::vector<size_t> foundLanguageIDs;
	static std::vector<std::wstring> foundLanguageStrs;
	unsigned int languagePage;
	//size_t langButtonCnt;
	//std::map<std::string, unsigned int> langMap;
//	static struct { char str[4]; unsigned int id; } langMap[];
//	static LANG langMap[];
};
